using System.Data;
using VanTaiProperty;

namespace VanTaiData
{
	public class clsTMRegionController
	{
	private clsConnect cls = new clsConnect();

	#region Getdata
	public DataTable BindGirdTMRegion(string keywords)
	{
        return cls.Search("sp_TMRegion_Search", "@KeyWords", keywords);
	}
	public DataTable BindGirdTMRegionDetail(int id)
	{
        return cls.LayDuLieuParameter("sp_TMRegion_Detail", "@Region_ID", id);
	}
    public DataTable BindGirdTMRegionFilterQuocGia(int id)
    {
        return cls.LayDuLieuParameter("sp_TMRegion_FilterQuocGia", "@National_ID", id);
    }
	#endregion

	#region Insert
	public bool InsertTMRegion(clsTMRegionProperty data)
	{
	cls.CreateNewSqlCommand();
    cls.AddParameter("@Region_Alias", data.Region_Alias);
    cls.AddParameter("@Region_Name", data.Region_Name);
    cls.AddParameter("@National_ID", data.National_ID);
    cls.AddParameter("@Region_Note", data.Region_Note);
    cls.AddParameter("@Region_MACHA", data.Region_MACHA);
    cls.AddParameter("@Region_NameE", data.Region_NameE);
    cls.AddParameter("@Region_NameC", data.Region_NameC);
    cls.ExecuteNonQuery("sp_TMRegion_Insert");
	return true;
	}
	#endregion

	#region Update
	public bool UpdateTMRegion(clsTMRegionProperty data)
	{
        cls.CreateNewSqlCommand();
        cls.AddParameter("@Region_ID", data.Region_ID);
        cls.AddParameter("@Region_Alias", data.Region_Alias);
        cls.AddParameter("@Region_Name", data.Region_Name);
        cls.AddParameter("@National_ID", data.National_ID);
        cls.AddParameter("@Region_Note", data.Region_Note);
        cls.AddParameter("@Region_MACHA", data.Region_MACHA);
        cls.AddParameter("@Region_NameE", data.Region_NameE);
        cls.AddParameter("@Region_NameC", data.Region_NameC);
        cls.ExecuteNonQuery("sp_TMRegion_Update");
	return true;
	}
	#endregion

	#region Delete
	public bool DeleteTMRegion(int id)
	{
        cls.Delete("sp_TMRegion_Delete", "@Region_ID", id);
	return true;
	}
	#endregion
	}
}